<template>
    <swiper>
      <swiper-item v-for="item in banners">
        <img :src="item.image"
             :key="item.title"
             @load="imgItemLoad"
             @click="itemClick"
             alt="">
      </swiper-item>
    </swiper>
</template>

<script>
  import {Swiper,SwiperItem} from 'components/common/swiper';
  export default {
    name: "homeSwiper",
    data(){
      return {
        isLoad: false
      }
    },
    props:{
      banners:{
        type: Array,
        default() {
          return []
        }
      }
    },
    components:{
      Swiper,
      SwiperItem
    },
    methods:{
      imgItemLoad(){
        if(!this.isLoad) {
          this.$emit('imgItemLoad')
          this.isLoad=true
        }
      },
      itemClick(){
        console.log(this.banners);
        this.$router.replace('/shopping')
      }
    }
  }
</script>

<style scoped>

</style>
